package com.example.demo.Strategy02;

/**
 * 返利
 */
public class CashReturn extends CashSuper {

    //满多少
    private double moneyCondition = 0.0d;
    //返多少
    private double moneyReturn = 0.0d;

    public CashReturn(String moneyCondition,String moneyReturn){
        this.moneyCondition = Double.valueOf(moneyCondition);
        this.moneyReturn = Double.valueOf(moneyReturn);
    }

    @Override
    double acceptCash(double money) {
        double result = money;
        if (money>moneyCondition){
            result = result - (int)(money / moneyCondition) * moneyReturn;
        }
        return result;
    }
}
